/**
 * Created by lixiang on 26/04/2017.
 */



$(function () {

    var memberPageVue = new Vue({
        el:'#divController',
        data:{
            memberPageInfo:{
                haveBuy:"",
                haveSend:"",
                needBug:""
            },
            memberMobile:"",
            registerMemberInfo:{
                mobilePhone:"",
                memberName:""
            }

        },
        methods:{
            queryMember:function () {

                this.$http.get(webRoot+'/member/queryMemberInfo/'+this.memberMobile).then(function(response)
                    {
                        var datas = response.body;
                        if(datas['error']=='0'){
                            this.memberPageInfo.haveBuy=datas['object']['haveBuy'];
                            this.memberPageInfo.needBuy=datas['object']['needBuy'];
                            $("#buyResult").css("visibility","visible");
                        }else{
                            alert(datas['message']);
                        }

                    },
                    function(response){
                        // error callback
                    });

            },
            registerMember:function () {

                this.$http.post(webRoot+'/member/newMemberInfo',this.registerMemberInfo).then(function(response)
                    {
                        var datas = response.body;
                        if(datas['error']=='0'){
                            alert(datas['message']);
                            window.location.reload();

                        }else{
                            alert(datas['message']);
                        }

                    },
                    function(response){
                        // error callback
                    });

            }

        }

    });


});




